<template>
  <el-row class="top-bar" type="flex" justify="space-between">
    <el-col>
      <el-button type="primary" @click="addFn">
        <slot name="left"> 添加分类 </slot>
      </el-button>
    </el-col>
    <el-col>
      <el-input v-model="searchText" placeholder="请输入内容" class="input-with-select">
        <el-button slot="append" icon="el-icon-search" @click="searchFn" /> </el-input
    ></el-col>
  </el-row>
</template>

<script>
export default {
  data() {
    return {
      searchText: ''
    }
  },
  methods: {
    addFn() {
      this.$emit('addFn')
    },
    searchFn() {
      this.$emit('searchFn', this.searchText)
      this.searchText = ''
    }
  }
}
</script>

<style lang="scss" scoped>
.top-bar {
  margin-bottom: 20px;
}
</style>
